<?php
set_time_limit(600);
require_once('tests.inc.php');

$TestGroups = array();
$files = glob(TEST_CASE_PATH.'/*');
foreach($files as $path)
{
        $p = split('/', $path);
        $group = count($p)-1;

        $cases = glob($path."/*.test.php");
        foreach($cases as $tf)
        {
                $t = split("/", $tf);
                $TestGroups[$p[$group]]['subdir'] = $p[$group-1].'/'.$p[$group];
                $TestGroups[$p[$group]]['files'][] = $t[count($t)-1];
        }
}

$test = &new GroupTest('All tests');
if (!empty($_POST['files']))
{
     foreach ($_POST['files'] as $key => $values)
     {
          foreach ($values as $item)
          {
               $test-> addTestFile($TestGroups[$key]['subdir'].'/'.$TestGroups[$key]['files'][$item]);
          }
     }
}

$test-> run(new HtmlReporter());
//$tpl = &LoadTpl();
//$tpl-> assign('Groups', $TestGroups);
//$tpl-> assign('Context', $_POST);
//$tpl-> display(TEST_PATH.'/index_tests.tpl');
?>